// -------------------------------------------------
// BlinKit - BlinKit Library
// -------------------------------------------------
//   File Name: html_parser_options.cpp
// Description: HTMLParserOptions Class
//      Author: Ziming Li
//     Created: 2022-03-30
// -------------------------------------------------
// Copyright (C) 2022 MingYang Software Technology.
// -------------------------------------------------

#include "./html_parser_options.h"

#include "blinkit/blink/renderer/bindings/core/script_controller.h"
#include "blinkit/blink/renderer/core/dom/document.h"
#include "blinkit/blink/renderer/core/frame/local_frame.h"

namespace blink {

static bool IsScriptEnabled(Document *document)
{
    if (nullptr != document)
    {
        if (LocalFrame *frame = document->frame())
            return frame->script().canExecuteScripts(NotAboutToExecuteScript);
    }
    return false;
}

HTMLParserOptions::HTMLParserOptions(Document *document) : scriptEnabled(IsScriptEnabled(document))
{
}

} // namespace blink
